

import axios from 'axios'
// import { transform } from 'jest.config'
const service = axios.create({})
// 添加请求拦截器
service.interceptors.request.use((config) => {
  return config
}, (error) => {
  return Promise.reject(error)
})

service.interceptors.response.use((response) => {
  return response
}, (error) => {
  return Promise.reject(error)
})

export function tranListToTreeData(list,rootValue){
  var arr=[]
  list.forEach(item => {
    if(item.pid===rootValue){
      const children = tranListToTreeData(list,item.id)
      if(children.length){
        item.children=children
      }
      arr.push(item)
    }
  })
  return arr
}